﻿using Enyim.Caching;
using Enyim.Caching.Configuration;
using Enyim.Caching.Memcached;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace MemCachedSample
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                MemcachedClientConfiguration cfg = new MemcachedClientConfiguration();
                cfg.Servers.Add(new IPEndPoint(IPAddress.Parse("121.46.130.92"), 11211));
                cfg.Protocol = MemcachedProtocol.Binary;
                MemcachedClient memcachedClient = new MemcachedClient(cfg);
                memcachedClient.Store(StoreMode.Set, "name", "gainorloss", TimeSpan.FromSeconds(3));
                var val = memcachedClient.Get("name");
                Thread.Sleep(3000);
                val = memcachedClient.Get("name");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }
    }
}
